public class Cuboid {
    /**
     * (1)私有成员变量包括长length、宽width和高height；
     * (2)构造方法包括一个公共的空构造方法，一个能够初始化所有成员变量的构造方法；
     * (3)包括所有的setter和getter方法，其中setter方法要求对形参进行验证，例如长、宽和高都大于0；
     * (4)功能方法包括计算表面积getArea()、计算体积getCubage()、判断是否正方体isCube()、输出该长方体的长宽高printCuboid()、绘制该长方体（给出提示信息即可）drawing()。
     * */
    private double length;
    private double width;
    private double height;

    public double getArea(){
        return 2.0 * (length*width+width*height+height*length);
    }

    public boolean isCube(){
        if (length==width && width==height){
            return true;
        }else{
            return false;
        }
    }

    public double getVolume(){
        return length*width*height;
    }

    public double getLength() {
        return length;
    }

    public void printCuboid(){
        System.out.println("长："+length+"，宽："+width+"，高："+height);
    }

    public void drawing(){
        System.out.println("长方体");
    }

    /*set get 方法*/

    public void setLength(double length) {
        if (length <= 0){
            throw new IllegalArgumentException("Length must be greater than 0");
        }
        this.length = length;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        if (width <= 0){
            throw new IllegalArgumentException("Width must be greater than 0");
        }
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        if (height <= 0){
            throw new IllegalArgumentException("Height must be greater than 0");
        }
        this.height = height;
    }

    @Override
    public String toString() {
        return "Cuboid{" +
                "length=" + length +
                ", width=" + width +
                ", height=" + height +
                '}';
    }

    Cuboid(double length, double width, double height) {
        if (length <= 0 || width <= 0 || height <= 0){
            throw new IllegalArgumentException("Length, width and height must be greater than 0");
        }
        this.length = length;
        this.width = width;
        this.height = height;
    }

    Cuboid() {
    }

}
